<template>
  <div class="auditwin" v-loading="isOutTime">
    <Table
      :name="{table,isbtn,pageNum,pageSize,pageLength}"
      @handleSelectionChange="handleSelectionChange"
      @examine="examine"
      @handleSizeChange="handleSizeChange"
      @handleCurrentChange="handleCurrentChange"
      @batchdelete="batchdelete"
      v-if="isShow"
    ></Table>
  </div>
</template>

<script>
import Table from "@/components/tableStyle/Table";

export default {
  data() {
    return {
      // 数据
      table: [],
      //预约成功：待定
      //审核通过：2
      //审核失败：3
      //审核中：1
      isbtn: 0,
      //分页
      pageNum: 1,
      pageSize: 10,
      pageLength: 0,
      //判断是否超时
      isOutTime: true,
      //判断数据是否获取到
      isShow: false,
      ids: "",
    };
  },
  components: { Table },
  methods: {
    //单选全选
    handleSelectionChange(value) {
      // ////console.log(value);
    },
    //预约成功查看详情
    examine(index, row) {
      // ////console.log(index, row);
    },
    //分页
    handleSizeChange(val) {
      this.pageSize = val;
      this.interface(this.ids);
    },
    handleCurrentChange(val) {
      this.pageNum = val;
      this.interface(this.ids);
    },
    //删除
    batchdelete(val) {
      // ////console.log(val);
    },
    //接口
    interface(val) {
      this.$http
        .get("/trademark/order/findByOrderId", {
          // status: this.isbtn,
          // userId: Number(this.$store.state.userId),
          params:{ pageNum: this.pageNum, pageSize: this.pageSize, orderId: val }
          // pageSize: this.pageSize,
        })
        .then((res) => {
          console.log(res);
          if (res.data.code !== 200) {
            this.$message.error("获取数据失败");
            this.isOutTime = false;
          } else {
            this.pageLength = res.data.data.total;
            this.table = res.data.data.data;
            for(let i = 0; i < this.table.length; i++){
              this.table[i]["commitStatus"] = 4;
              this.table[i]["branchNetworkId"] = this.table[i].deptName;
              this.table[i]["category"] = this.table[i].name
            }
            this.isShow = true;
            this.isOutTime = false;
            // ////console.log(this.isShow);
          }
        })
        .catch((err) => {
          this.$message.error("服务器崩溃！");
          this.isShow = true;
          this.isOutTime = false;
        });
    },
  },
  mounted() {
    this.ids = this.$route.query.ids;
    console.log(this.ids, 123456);
    this.interface(this.ids);
  },
};
</script>

<style lang="less" scoped>
</style>